#include<iostream>
#include<memory>
#include<unistd.h>
#include<mutex>
#include"Thread.hpp"

// std::mutex mtx;

void* thread_run(void* args)
{
    // mtx.lock();
    std::string work_type = static_cast<const char*>(args);
    while(true)
    {
        sleep(1);
        std::cout << "我是一个新线程，我正在做" << work_type << std::endl;
    }
    // mtx.unlock();
}
int main()
{
    // Thread(func_t func,void* args,int number);
    std::unique_ptr<Thread> thread1(new Thread(thread_run,(void*)"hello world",1));
    std::unique_ptr<Thread> thread2(new Thread(thread_run,(void*)"count world",2));
    std::unique_ptr<Thread> thread3(new Thread(thread_run,(void*)"log world",3));
    thread1->start();
    thread2->start();
    thread3->start();

    thread1->join();
    thread2->join();
    thread3->join();
    return 0;
}